import React, { Component } from 'react';
import { Result } from 'antd';
import { connect } from 'dva';
import router from 'umi/router';
import style from './style.less';
import imgUrl from '../../assets/system-update.png';

@connect(({ publicdata }) => ({ publicdata }))
class Update extends Component {
  state = {};

  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'workplace/searchFunParams',
    }).then(res => {
      if (res.rspCode === 'DONE') {
        router.replace('/home/workplace/index');
      }
    });
  }

  render() {
    const {
      publicdata: { upgradeTitle, upgradeContent },
    } = this.props;
    return (
      <div className={style.upgradeBox}>
        <Result
          icon={<img src={imgUrl} draggable="false" alt="" />}
          title={upgradeTitle}
          subTitle={upgradeContent}
        />
      </div>
    );
  }
}

export default Update;
